<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Object>" %>

<% Html.PartialSequencer().Next(); %>
<div id="<%= "SearchGridPlaceHolder" + Html.PartialSequencer().Current() %>">
    <% using (Ajax.BeginForm("Grid", new AjaxOptions { UpdateTargetId = "GridPlaceHolder" + Html.PartialSequencer().Current() }))
       { %>
            <% // http://stackoverflow.com/questions/1219223/asp-net-mvc-getting-html-beginform-to-remember-querystring-params-when-submit %>
            <% Request.QueryString.AllKeys.Where(k => !k.StartsWith("Search")).ToList().ForEach(k => Response.Write(Html.Hidden(k, HttpContext.Current.Request.QueryString[k]))); %>

            <%= Html.TextBox("Search") %>
            <input type="submit" value="Search" />        
    <% } %>
    <div id="<%= "GridPlaceHolder" + Html.PartialSequencer().Current() %>" class="AjaxGridPaging">
        <% Html.RenderPartial("Grid"); %>
    </div>
</div>
